package com.haoshuang.zhouzhoubang.ui.page.order.take.record.fragment

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.TakeOrderRecordBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class TakeOrderRecordChildViewModel : BaseViewModel() {

    /**
     * 门店下单记录
     */
    val getTeamOrderRecordData = StatefulMutableLiveData<MutableList<TakeOrderRecordBean>>()
    fun getTeamOrderRecord(status: Int, page: Int) = netRequest {
        start { getTeamOrderRecordData.value = StateData.Loading }
        request { ApiRepo.getTeamOrderRecord(status, page)  }
        success { getTeamOrderRecordData.value = StateData.Success(it.data) }
        error { code, msg ->
            getTeamOrderRecordData.value = StateData.Error(code, msg)
        }
    }

}